$(function() {

	var $fullText = $('.admin-fullText');
	$('#admin-fullscreen').on('click', function() {
		$.AMUI.fullscreen.toggle();
	});

	$(document).on($.AMUI.fullscreen.raw.fullscreenchange, function() {
		$fullText.text($.AMUI.fullscreen.isFullscreen ? '退出全屏' : '开启全屏');
	});

	$('#logout-link').on('click', function() {
		
		$.ajax({
			type : "GET",
			url : "login?oper=leave",
			dataType:"json",
			success : function(data) {
				if(data.code==0){
					window.location = 'login.html';
				}else{
					layer.msg('退出不成功');
				}
			}
		});

		
	});

	$('.tpl-switch').find('.tpl-switch-btn-view').on('click', function() {
		$(this).prev('.tpl-switch-btn').prop("checked", function() {
			if ($(this).is(':checked')) {
				return false
			} else {
				return true
			}
		})

	})
})
// ==========================
// 侧边导航下拉列表
// ==========================

$('.tpl-left-nav-link-list').on(
		'click',
		function() {
			$(this).siblings('.tpl-left-nav-sub-menu').slideToggle(80).end()
					.find('.tpl-left-nav-more-ico').toggleClass(
							'tpl-left-nav-more-ico-rotate');
		})
// ==========================
// 头部导航隐藏菜单
// ==========================

$('.tpl-header-nav-hover-ico').on('click', function() {
	$('.tpl-left-nav').toggle();
	$('.tpl-content-wrapper').toggleClass('tpl-content-wrapper-hover');
})

/**
 * 美化信息提示框
 * 
 * @param msg
 */
function alert(msg) {
	layer.msg(msg);
}
